#!/bin/bash  
  
# 假设Depends信息作为字符串直接给出，或者从文件中读取  
DEPENDS="libc6 (>= 2.29), libgcc-s1 (>= 3.0), libgsettings-qt1 (>= 0.1+14.04.20140408), libkysdk-qtwidgets (>= 2.0.2.1), libkysdk-waylandhelper (>= 1.2.0.3), libmpv1 (>= 0.4.0), libqt5core5a (>= 5.12.2), libqt5dbus5 (>= 5.0.2), libqt5gui5 (>= 5.8.0) | libqt5gui5-gles (>= 5.8.0), libqt5multimedia5 (>= 5.6.0~beta), libqt5network5 (>= 5.0.2), libqt5sql5 (>= 5.0.2), libqt5widgets5 (>= 5.11.0~rc1), libqt5x11extras5 (>= 5.6.0), libstdc++6 (>= 5.2), libukui-log4qt1 (>= 1.0.1.11), libx11-6"  
  
# 使用awk提取包名和版本信息  
echo "$DEPENDS" | awk -F '[, ]' '{  
    for (i = 1; i <= NF; i++) {  
        # 跳过非包名的字段  
        if ($i ~ /^lib/) {  
            # 分割包名和版本信息  
            split($i, a, " (");  
            package_name=a[1];  
            version_req=a[2];  
            gsub(")", "", version_req); # 移除括号  
            print "Package Name: " package_name;  
            print "Version Requirement: " version_req;  
            print "------------------------";  
        }  
    }  
}'
